From 2543c86b2a4974cbaf2efc78bcc873fb57f650f9 Mon Sep 17 00:00:00 2001 From: "emellor@ewan" Date: Wed, 12 Oct 2005 10:07:04 +0100 Subject: [PATCH] Issue diagnostics if xm is being run as a non-root user. This used to happen, but the triggering error has moved, so the diagnostics were broken. Signed-off-by: Ewan Mellor --- tools/python/xen/xm/main.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py index 082bdb6367..11e2ff7194 100644 --- a/tools/python/xen/xm/main.py +++ b/tools/python/xen/xm/main.py @@ -688,11 +688,16 @@ def main(argv=sys.argv): if rc: usage() except socket.error, ex: - print >>sys.stderr, ex - err("Error connecting to xend, is xend running?") + if os.geteuid() != 0: + err("Most commands need root access. Please try again as root.") + else: + err("Error connecting to xend: %s. Is xend running?" % ex[1]) sys.exit(1) except IOError: - err("Most commands need root access. Please try again as root") + if os.geteuid() != 0: + err("Most commands need root access. Please try again as root.") + else: + err("Error connecting to xend: %s." % ex[1]) sys.exit(1) except xen.xend.XendError.XendError, ex: if len(args) > 0: -- 2.30.2